﻿using HamcoWcs.Entitys.MainTasks;
using HamcoWcs.Models.ForeEndModels.UITasks;
using HamcoWcs.Models.TibcoMessage.Items;
using System.Threading.Tasks;

namespace HamcoWcs.Contract.ContractMainTask
{
    public interface IBaseMainTaskService
    {
        //bool UpdateSubTaskStatus(long taskId, EnumSubTaskStatus taskStatus);

        /// <summary>WCS创建任务</summary>
        MainTask CreateTaskByWcs(MainTaskCreate create);
        MainTask CreateAbnormalOutboundTask(MainTaskCreate create);
        /// <summary>MES创建任务</summary>
        void CreateTaskByMes(string message);
        /// <summary>判断目标托盘任务是否存在</summary>
        bool ChcekPalletTaskExists(string unitId);
        void CreatSubTask(MainTask mainTask);
        void DeleteMainTask(MainTask mainTask);
        void CancelMainTask(MainTask mainTask);
        void FinishMainTask(MainTask mainTask);
        void SetMainTaskError(MainTask mainTask);

        void ReportStart(MainTask mainTask);
        //void CreateErrorTask(string from, int errorflag, string unitId);

        /// <summary>
        /// 判断任务
        /// </summary>
        /// <param name="mainTask"></param>
        void CheckTimeout(MainTask mainTask);
        void CheckCreateTimeout(MainTask mainTask);
        //MainTask GetCurrentMainTaskByPallet(string unitId);

        MachineAddressDto GetTargetAddress(string target, bool isFrom = true);

        string GetMainTaskType(string f, string t);
    }
}
